home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / gxx / gpincl20.zoo / ioprivat.h < prev    next >
C/C++ Source or Header  |  1993-07-13  |  2KB  |  68 lines

  1. //    This is part of the iostream library, providing -*- C++ -*- input/output.
  2. //    Copyright (C) 1991 Per Bothner.
  3. //
  4. //    This library is free software; you can redistribute it and/or
  5. //    modify it under the terms of the GNU Library General Public
  6. //    License as published by the Free Software Foundation; either
  7. //    version 2 of the License, or (at your option) any later version.
  8. //
  9. //    This library is distributed in the hope that it will be useful,
  10. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. //    Library General Public License for more details.
  13. //
  14. //    You should have received a copy of the GNU Library General Public
  15. //    License along with this library; if not, write to the Free
  16. //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. #include <stddef.h>
  19. #include <stdlib.h>
  20. #include <string.h>
  21. #include <unistd.h>
  22. #include <streambu.h>
  23. #include <stdarg.h>
  24. #include <stddef.h>
  25.  
  26. #define _fstat(x, y) fstat(x,y)
  27. #define _isatty(fd) isatty(fd)
  28.  
  29. extern int __cvt_double(double number, int prec, int flags,
  30.             int *signp, int fmtch, char *startp, char *endp);
  31.  
  32. /*#define USE_MALLOC_BUF*/
  33. #ifdef atarist
  34. #define USE_MALLOC_BUF 1
  35. #endif
  36.  
  37. #ifndef USE_MALLOC_BUF
  38. #define ALLOC_BUF(size) new char[size]
  39. #define FREE_BUF(ptr) delete [] (ptr)
  40. #else
  41. #define ALLOC_BUF(size) (char*)malloc(size)
  42. #define FREE_BUF(ptr) free(ptr)
  43. #endif
  44.  
  45. #define USE_DTOA
  46.  
  47. // Advantages:
  48. // - Input gets closest value
  49. // - Output emits string that when read yields identical value.
  50. // - Handles Infinity and NaNs (but not re-readable).
  51. // Disadvantages of dtoa:
  52. // - May not work for all double formats.
  53. // - Big chunck of code.
  54. // - Not reentrant - uses atatic variables freelist,
  55. //   result, result_k in dtoa
  56. //   (plus initializes p5s, HOWORD, and LOWORD).
  57.  
  58. #ifdef USE_DTOA
  59. extern "C" double _Xstrtod(const char *s00, char **se);
  60. #define strtod(s, e) _Xstrtod(s, e)
  61. extern "C" char *dtoa(double d, int mode, int ndigits,
  62.                         int *decpt, int *sign, char **rve);
  63. extern int __outfloat(double value, streambuf *sb, char mode,
  64.            int width, int precision, __fmtflags flags,
  65.            char sign_mode, char fill);
  66. #endif
  67.  
  68.